<script setup>
import IconFlame from "@/components/icons/IconFlame.vue";
import IconHeart from "@/components/icons/IconHeart.vue";
import IconEasel from "@/components/icons/IconEasel.vue";
import IconFlag from "@/components/icons/IconFlag.vue";
import NormalCard from "@/components/video_card/NormalCard.vue";

import {reactive} from 'vue';

import { courseGetSimpleInfoList } from "@/api/course/course_dql"
courseGetSimpleInfoList({}).then((data) => {
  console.log(data);
})

const categoryList = reactive([])

const genCategory = () => {
  for (let i = 0; i < 13; i++) {
    categoryList.push({
      name: '专业' + (i + 1)
    })
  }
}
genCategory();
</script>

<template>
  <el-carousel indicator-position="outside">
    <el-carousel-item v-for="item in 4" :key="item">
      <h3 text="2xl" justify="center">{{ item }}</h3>
    </el-carousel-item>
  </el-carousel>

  <div class="category-row">
    <el-row class="left">
      <el-col :span="8">
        <div class="icon-box">
          <IconFlame width="3em" height="3em"></IconFlame>
          <span>热门</span>
        </div>
      </el-col>
      <el-col :span="8">
        <div class="icon-box">
          <IconEasel width="3em" height="3em"></IconEasel>
          <span>班级</span>
        </div>
      </el-col>
      <el-col :span="8">
        <div class="icon-box">
          <IconHeart width="3em" height="3em"></IconHeart>
          <span>订阅</span>
        </div>
      </el-col>
    </el-row>
    <el-divider direction="vertical"/>
    <div class="middle">
      <el-button v-for="item in categoryList"><span class="category-btn">{{ item.name }}</span></el-button>
      <el-button><span class="category-btn">更多 >></span></el-button>
    </div>
    <el-divider direction="vertical"/>
    <div class="right">
      <div class="item">
        <IconFlag width="1.5em" height="1.5em"></IconFlag>
        <span class="text">活动</span>
      </div>
      <div class="item">
        <IconFlag width="1.5em" height="1.5em"></IconFlag>
        <span class="text">活动</span>
      </div>
      <div class="item">
        <IconFlag width="1.5em" height="1.5em"></IconFlag>
        <span class="text">活动</span>
      </div>
      <div class="item">
        <IconFlag width="1.5em" height="1.5em"></IconFlag>
        <span class="text">活动</span>
      </div>
      <div class="item">
        <IconFlag width="1.5em" height="1.5em"></IconFlag>
        <span class="text">活动</span>
      </div>
      <div class="item">
        <IconFlag width="1.5em" height="1.5em"></IconFlag>
        <span class="text">活动</span>
      </div>
    </div>
  </div>

  <div class="videos-row">
    <div class="video-card">
      <NormalCard></NormalCard>
    </div>
    <div class="video-card">
      <NormalCard></NormalCard>
    </div>
    <div class="video-card">
      <NormalCard></NormalCard>
    </div>
    <div class="video-card">
      <NormalCard></NormalCard>
    </div>
    <div class="video-card">
      <NormalCard></NormalCard>
    </div>

  </div>
  <div style="margin-bottom: 100rem"></div>
</template>

<style scoped>
.icon-box {
  display: flex;
  flex-direction: column;
  place-items: center;
  line-height: normal;
  font-size: medium;
}

.icon-box span {
  font-weight: bolder;
}

.category-row {
  width: 100%;
  display: flex;
  margin-bottom: 1rem;
}

.category-row .el-divider {
  height: 75px;
}

.category-row .left {
  width: 15%;
  text-align: center;
}

.category-row .middle {
  width: 70%;
  display: flex;
  flex-wrap: wrap;
  place-content: space-around;
}

.category-row .middle .el-button {
  margin: 0.2rem;
}

.category-row .right {
  width: 15%;
  display: grid;
  grid-template-columns: auto auto auto;
}

.category-row .right .item {
  cursor: pointer;
  display: flex;
  place-items: center;
  padding-left: 0.5rem;
}
.category-row .right .item:hover {
  background-color: var(--el-menu-hover-bg-color);
}

.category-row .right .item .text{
  font-size: medium;
  font-weight: bold;
  margin-left: -10px;
}

.category-btn {
  width: 5rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.videos-row {
  width: 100%;
  display: flex;
  justify-items: center;
}

.videos-row .video-card {
  padding: 0.5rem;
}

.el-carousel__item h3 {
  display: flex;
  color: #475669;
  opacity: 0.75;
  line-height: 300px;
  margin: 0;
}

.el-carousel__item:nth-child(2n) {
  background-color: #99a9bf;
}

.el-carousel__item:nth-child(2n + 1) {
  background-color: #d3dce6;
}

</style>